/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cc.altius.service.impl;

import cc.altius.dao.UserDao;
import cc.altius.domain.Password;
import cc.altius.domain.Role;
import cc.altius.domain.User;
import cc.altius.service.UserService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 *
 * @author Akil Mahimwala
 */
@Service("userService")
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public List<User> getUserList() {
        return this.userDao.getUserList();
    }

    @Override
    public List<Role> getRoleList() {
        return this.userDao.getRoleList();
    }

    @Override
    public void updateUser(User user) {
        this.userDao.updateUser(user);
    }

    @Override
    public int addUser(User user) {
        return this.userDao.addUser(user);
    }

    @Override
    public User getUserByUsername(String username) {
        return this.userDao.getUserByUsername(username);
    }

    @Override
    public boolean existUserByUsername(String username) {
        if (this.userDao.getUserByUsername(username)==null) {
            return false;
        } else {
            return true;
        }
    }

    @Override
    public User getUserByUserId(int userId) {
        return this.userDao.getUserByUserId(userId);
    }

    @Override
    public boolean confirmPassword(Password password) {
        return this.userDao.confirmPassword(password);
    }

    @Override
    public void updatePassword(Password password, int offset) {
        this.userDao.updatePassword(password, offset);
    }

    @Override
    public List<String> getBusinessFunctionsForUserId(int userId) {
        return this.userDao.getBusinessFunctionsForUserId(userId);
    }

    @Override
    public int incrementFailedCountForUsername(String username) {
        return this.userDao.incrementFailedCountForUsername(username);
    }

    @Override
    public void resetFailedCountForUserId(int userId) {
        this.userDao.resetFailedCountForUserId(userId);
    }

    @Override
    public List<User> getUserListForReport() {
       return this.userDao.getUserListForReport();
    }

    @Override
    public List<User> getActiveUserListForTicket() {
        return this.userDao.getActiveUserListForTicket();
    }

}
